package utils;

import java.util.ArrayList;
import java.util.List;

import pojo.News;

public class PageUtil<T> {

	public static Integer PAGESIZE =10;

	private Integer page;

	private Integer rows;

	private Integer start;

	private List<T> news = new ArrayList<T>();

	private Integer totalPage;

	@Override
	public String toString() {
		return "PageUtil [page=" + page + ", rows=" + rows + ", start=" + start + ", totalPage=" + totalPage + "]";
	}

	public List<T> getNews() {
		return news;
	}

	public void setNews(List<T> news) {
		this.news = news;
	}

	public Integer getTotalPage() {
		return totalPage;

	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
		this.totalPage = (rows / PAGESIZE) + (rows % PAGESIZE == 0 ? 0 : 1);
	}

	public Integer getStart() {

		return start;
	}

	public void setStart(Integer start) {
		this.start = start;
	}

}
